package c.b.a.b.c0;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.ContextThemeWrapper;
import c.b.a.b.l;

public class k {

    /* renamed from: a  reason: collision with root package name */
    d f1840a;

    /* renamed from: b  reason: collision with root package name */
    d f1841b;

    /* renamed from: c  reason: collision with root package name */
    d f1842c;

    /* renamed from: d  reason: collision with root package name */
    d f1843d;
    c e;
    c f;
    c g;
    c h;
    f i;
    f j;
    f k;
    f l;

    public static final class b {
        /* access modifiers changed from: private */

        /* renamed from: a  reason: collision with root package name */
        public d f1844a = h.b();
        /* access modifiers changed from: private */

        /* renamed from: b  reason: collision with root package name */
        public d f1845b = h.b();
        /* access modifiers changed from: private */

        /* renamed from: c  reason: collision with root package name */
        public d f1846c = h.b();
        /* access modifiers changed from: private */

        /* renamed from: d  reason: collision with root package name */
        public d f1847d = h.b();
        /* access modifiers changed from: private */
        public c e = new a(0.0f);
        /* access modifiers changed from: private */
        public c f = new a(0.0f);
        /* access modifiers changed from: private */
        public c g = new a(0.0f);
        /* access modifiers changed from: private */
        public c h = new a(0.0f);
        /* access modifiers changed from: private */
        public f i = h.c();
        /* access modifiers changed from: private */
        public f j = h.c();
        /* access modifiers changed from: private */
        public f k = h.c();
        /* access modifiers changed from: private */
        public f l = h.c();

        public b() {
        }

        public b(k kVar) {
            this.f1844a = kVar.f1840a;
            this.f1845b = kVar.f1841b;
            this.f1846c = kVar.f1842c;
            this.f1847d = kVar.f1843d;
            this.e = kVar.e;
            this.f = kVar.f;
            this.g = kVar.g;
            this.h = kVar.h;
            this.i = kVar.i;
            this.j = kVar.j;
            this.k = kVar.k;
            this.l = kVar.l;
        }

        private static float n(d dVar) {
            if (dVar instanceof j) {
                return ((j) dVar).f1839a;
            }
            if (dVar instanceof e) {
                return ((e) dVar).f1828a;
            }
            return -1.0f;
        }

        public b A(c cVar) {
            this.e = cVar;
            return this;
        }

        public b B(int i2, c cVar) {
            C(h.a(i2));
            E(cVar);
            return this;
        }

        public b C(d dVar) {
            this.f1845b = dVar;
            float n = n(dVar);
            if (n != -1.0f) {
                D(n);
            }
            return this;
        }

        public b D(float f2) {
            this.f = new a(f2);
            return this;
        }

        public b E(c cVar) {
            this.f = cVar;
            return this;
        }

        public k m() {
            return new k(this);
        }

        public b o(float f2) {
            z(f2);
            D(f2);
            v(f2);
            r(f2);
            return this;
        }

        public b p(int i2, c cVar) {
            q(h.a(i2));
            s(cVar);
            return this;
        }

        public b q(d dVar) {
            this.f1847d = dVar;
            float n = n(dVar);
            if (n != -1.0f) {
                r(n);
            }
            return this;
        }

        public b r(float f2) {
            this.h = new a(f2);
            return this;
        }

        public b s(c cVar) {
            this.h = cVar;
            return this;
        }

        public b t(int i2, c cVar) {
            u(h.a(i2));
            w(cVar);
            return this;
        }

        public b u(d dVar) {
            this.f1846c = dVar;
            float n = n(dVar);
            if (n != -1.0f) {
                v(n);
            }
            return this;
        }

        public b v(float f2) {
            this.g = new a(f2);
            return this;
        }

        public b w(c cVar) {
            this.g = cVar;
            return this;
        }

        public b x(int i2, c cVar) {
            y(h.a(i2));
            A(cVar);
            return this;
        }

        public b y(d dVar) {
            this.f1844a = dVar;
            float n = n(dVar);
            if (n != -1.0f) {
                z(n);
            }
            return this;
        }

        public b z(float f2) {
            this.e = new a(f2);
            return this;
        }
    }

    public interface c {
        c a(c cVar);
    }

    public k() {
        this.f1840a = h.b();
        this.f1841b = h.b();
        this.f1842c = h.b();
        this.f1843d = h.b();
        this.e = new a(0.0f);
        this.f = new a(0.0f);
        this.g = new a(0.0f);
        this.h = new a(0.0f);
        this.i = h.c();
        this.j = h.c();
        this.k = h.c();
        this.l = h.c();
    }

    private k(b bVar) {
        this.f1840a = bVar.f1844a;
        this.f1841b = bVar.f1845b;
        this.f1842c = bVar.f1846c;
        this.f1843d = bVar.f1847d;
        this.e = bVar.e;
        this.f = bVar.f;
        this.g = bVar.g;
        this.h = bVar.h;
        this.i = bVar.i;
        this.j = bVar.j;
        this.k = bVar.k;
        this.l = bVar.l;
    }

    public static b a() {
        return new b();
    }

    public static b b(Context context, int i2, int i3) {
        return c(context, i2, i3, 0);
    }

    private static b c(Context context, int i2, int i3, int i4) {
        return d(context, i2, i3, new a((float) i4));
    }

    private static b d(Context context, int i2, int i3, c cVar) {
        if (i3 != 0) {
            ContextThemeWrapper contextThemeWrapper = new ContextThemeWrapper(context, i2);
            i2 = i3;
            context = contextThemeWrapper;
        }
        TypedArray obtainStyledAttributes = context.obtainStyledAttributes(i2, l.ShapeAppearance);
        try {
            int i4 = obtainStyledAttributes.getInt(l.ShapeAppearance_cornerFamily, 0);
            int i5 = obtainStyledAttributes.getInt(l.ShapeAppearance_cornerFamilyTopLeft, i4);
            int i6 = obtainStyledAttributes.getInt(l.ShapeAppearance_cornerFamilyTopRight, i4);
            int i7 = obtainStyledAttributes.getInt(l.ShapeAppearance_cornerFamilyBottomRight, i4);
            int i8 = obtainStyledAttributes.getInt(l.ShapeAppearance_cornerFamilyBottomLeft, i4);
            c m = m(obtainStyledAttributes, l.ShapeAppearance_cornerSize, cVar);
            c m2 = m(obtainStyledAttributes, l.ShapeAppearance_cornerSizeTopLeft, m);
            c m3 = m(obtainStyledAttributes, l.ShapeAppearance_cornerSizeTopRight, m);
            c m4 = m(obtainStyledAttributes, l.ShapeAppearance_cornerSizeBottomRight, m);
            c m5 = m(obtainStyledAttributes, l.ShapeAppearance_cornerSizeBottomLeft, m);
            b bVar = new b();
            bVar.x(i5, m2);
            bVar.B(i6, m3);
            bVar.t(i7, m4);
            bVar.p(i8, m5);
            return bVar;
        } finally {
            obtainStyledAttributes.recycle();
        }
    }

    public static b e(Context context, AttributeSet attributeSet, int i2, int i3) {
        return f(context, attributeSet, i2, i3, 0);
    }

    public static b f(Context context, AttributeSet attributeSet, int i2, int i3, int i4) {
        return g(context, attributeSet, i2, i3, new a((float) i4));
    }

    public static b g(Context context, AttributeSet attributeSet, int i2, int i3, c cVar) {
        TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, l.MaterialShape, i2, i3);
        int resourceId = obtainStyledAttributes.getResourceId(l.MaterialShape_shapeAppearance, 0);
        int resourceId2 = obtainStyledAttributes.getResourceId(l.MaterialShape_shapeAppearanceOverlay, 0);
        obtainStyledAttributes.recycle();
        return d(context, resourceId, resourceId2, cVar);
    }

    private static c m(TypedArray typedArray, int i2, c cVar) {
        TypedValue peekValue = typedArray.peekValue(i2);
        if (peekValue == null) {
            return cVar;
        }
        int i3 = peekValue.type;
        return i3 == 5 ? new a((float) TypedValue.complexToDimensionPixelSize(peekValue.data, typedArray.getResources().getDisplayMetrics())) : i3 == 6 ? new i(peekValue.getFraction(1.0f, 1.0f)) : cVar;
    }

    public f h() {
        return this.k;
    }

    public d i() {
        return this.f1843d;
    }

    public c j() {
        return this.h;
    }

    public d k() {
        return this.f1842c;
    }

    public c l() {
        return this.g;
    }

    public f n() {
        return this.l;
    }

    public f o() {
        return this.j;
    }

    public f p() {
        return this.i;
    }

    public d q() {
        return this.f1840a;
    }

    public c r() {
        return this.e;
    }

    public d s() {
        return this.f1841b;
    }

    public c t() {
        return this.f;
    }

    public boolean u(RectF rectF) {
        Class<f> cls = f.class;
        boolean z = this.l.getClass().equals(cls) && this.j.getClass().equals(cls) && this.i.getClass().equals(cls) && this.k.getClass().equals(cls);
        float a2 = this.e.a(rectF);
        return z && ((this.f.a(rectF) > a2 ? 1 : (this.f.a(rectF) == a2 ? 0 : -1)) == 0 && (this.h.a(rectF) > a2 ? 1 : (this.h.a(rectF) == a2 ? 0 : -1)) == 0 && (this.g.a(rectF) > a2 ? 1 : (this.g.a(rectF) == a2 ? 0 : -1)) == 0) && ((this.f1841b instanceof j) && (this.f1840a instanceof j) && (this.f1842c instanceof j) && (this.f1843d instanceof j));
    }

    public b v() {
        return new b(this);
    }

    public k w(float f2) {
        b v = v();
        v.o(f2);
        return v.m();
    }

    public k x(c cVar) {
        b v = v();
        v.A(cVar.a(r()));
        v.E(cVar.a(t()));
        v.s(cVar.a(j()));
        v.w(cVar.a(l()));
        return v.m();
    }
}
